<?php
	include "./addons/pupop/config/config.php";
	include "./addons/pupop/expand/common.html";
?>
<?php
if($lywq['pupop']['snow']['status'] == 1){
	include "./addons/pupop/html/snow_pupop.html";
} ?>
<!--自动弹窗代码部分-->
<div id="lywq_pupop" class="lywq_cox" style="display:none">
<div class="lywq_tc">
	<div class="lywq_tc1">
		<?php echo $lywq['pupop']['title'];?>
		<br />
	</div>
	<div class="content_pupop" >
		<?php
			if ($lywq['pupop']['type'] == 1) {
				echo '<img src="' .$lywq['pupop']['content']['image']. '" width="60%" />';	
			} elseif ($lywq['pupop']['type'] == 2) { 
				echo '<span style="color:red">' .$lywq['pupop']['content']['text']. '</span>';
			} elseif ($lywq['pupop']['type'] == 3) {
				echo '<img src="' .$lywq['pupop']['content']['image']. '" width="50%" />';
				echo '<br/>';
				echo '<span style="color:red">' .$lywq['pupop']['content']['text']. '</span>';
			}
		?>
	</div>
	<div class="lywq_redbox">
		<div class="lywq_buttonred lywq_mar">
			<input type="submit" value="<?php echo $lywq['pupop']['leftbutton']['name'];?>" class="btn_pupop" onClick="leftUrl();jQuery(&#39;.lywq_cox&#39;).hide()">
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="submit" value="<?php echo $lywq['pupop']['rightbutton']['name'];?>" class="btn_pupop" onclick="rightUrl();jQuery(&#39;.lywq_cox&#39;).hide()"> 
		</div>	
	</div>
</div>	
</div>


<!--手动弹窗代码部分-->
<div id="lywq_Hpupop" class="lywq_cox" style="display:none">
<div class="lywq_tc">
	<div class="lywq_tc1">
		<?php echo $lywq['Hpupop']['title'];?>
		<br />
	</div>
	<div class="content_pupop" >
		<?php
			if ($lywq['Hpupop']['type'] == 1) {
				echo '<img src="' .$lywq['Hpupop']['content']['image']. '" width="60%" />';	
			} elseif ($lywq['Hpupop']['type'] == 2) { 
				echo '<span style="color:red">' .$lywq['Hpupop']['content']['text']. '</span>';
			} elseif ($lywq['Hpupop']['type'] == 3) {
				echo '<img src="' .$lywq['Hpupop']['content']['image']. '" width="50%" />';
				echo '<br/>';
				echo '<span style="color:red">' .$lywq['Hpupop']['content']['text']. '</span>';
			}
		?>
	</div>
	<div class="lywq_redbox">
		<div class="lywq_buttonred lywq_mar">
			<input type="submit" value="<?php echo $lywq['Hpupop']['leftbutton']['name'];?>" class="btn_pupop" onClick="leftUrlH();jQuery(&#39;.lywq_cox&#39;).hide()">
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="submit" value="<?php echo $lywq['Hpupop']['rightbutton']['name'];?>" class="btn_pupop" onclick="rightUrlH();jQuery(&#39;.lywq_cox&#39;).hide()"> 
		</div>	
	</div>
</div>	
</div>

<script type="text/javascript">
(function(){
	var phoneWidth = parseInt(window.screen.width),
		phoneScale = phoneWidth/640,
		ua = navigator.userAgent;
	if (/Android (\d+\.\d+)/.test(ua)){
		var version = parseFloat(RegExp.$1);
		if(version > 2.3){
			document.write('<meta name="viewport" content="width=device-width, initial-scale=0.75, minimum-scale=0.75, maximum-scale=0.75, user-scalable=no">');
		}
	} else {
		document.write('<meta name="viewport" content="width=device-width, initial-scale=0.76, minimum-scale=0.76, maximum-scale=0.76, user-scalable=no">');
	}
})();

function leftUrl(){
	if('<?php echo $lywq['pupop']['leftbutton']['url'];?>'!=''){
		window.location.href='<?php echo $lywq['pupop']['leftbutton']['url'];?>'
	}
}
function rightUrl(){
	if('<?php echo $lywq['pupop']['rightbutton']['url'];?>'!=''){
		window.location.href='<?php echo $lywq['pupop']['rightbutton']['url'];?>'
	}
}
function lywq_openpupop(){
	var div=document.getElementById("lywq_pupop");
	div.style.display="block"
}


function leftUrlH(){
	if('<?php echo $lywq['Hpupop']['leftbutton']['url'];?>'!=''){
		window.location.href='<?php echo $lywq['Hpupop']['leftbutton']['url'];?>'
	}
}
function rightUrlH(){
	if('<?php echo $lywq['Hpupop']['rightbutton']['url'];?>'!=''){
		window.location.href='<?php echo $lywq['Hpupop']['rightbutton']['url'];?>'
	}
}
function lywq_openHpupop(){
	var div=document.getElementById("lywq_Hpupop");
	div.style.display="block"
}


if (browser.versions.mobile) {
        if(browser.versions.android && !browser.versions.bsl){
            if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('android')!==-1){
            	cookieController();
            }
    	}
        if (browser.versions.ios) {
            if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('ios')!==-1){
            	cookieController();
            }
        }
        if (browser.versions.weixin) {
            if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('weixin')!==-1){
            	cookieController();
            }
        }
        if (browser.versions.qq) {
            if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('qq')!==-1){
            	cookieController();
            }
        }
        if (browser.versions.bsl) {
            if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('bsl')!==-1){
            	cookieController();
            }
        }
}else{
    if('<?php echo $lywq['pupop']['terminal'];?>'.indexOf('pc')!==-1){
    	cookieController();
    }
}


function cookieController(){
	if('<?php echo $lywq['pupop']['status'];?>'==1){
		if('<?php echo $lywq['pupop']['interval']['type'];?>'==0){
	    	lywq_openpupop();
		}
		if('<?php echo $lywq['pupop']['interval']['type'];?>'==1){
	    	var value = checkCookie('lywq_pupop_cookie');
	    	if(value==false){
	    		lywq_openpupop();
	    		setCookie('lywq_pupop_cookie','time','<?php echo $lywq['pupop']['interval']['time'];?>');
	    	}
		}
		if('<?php echo $lywq['pupop']['interval']['type'];?>'==2){
	    	var value = checkCookie('lywq_pupop_cookie');
	    	if(value==false){
	    		lywq_openpupop();
	    		var number = '<?php echo $lywq['pupop']['interval']['number'];?>';
	    		var expire = (24*60)/number ;
	    		setCookie('lywq_pupop_cookie','number',expire);
	    	}
		}
	} 
}
</script>
<style>
* {padding: 0;margin: 0;}
/*a {text-decoration: none;}*/
.lywq_tc{width: 360px;height: 360px;border: 5px solid #FFA500;border-radius: 10px;position:fixed;top:-30px;right:0;left:0;bottom:0;margin:auto;background: #fff;}
.lywq_tc1{width: 360px;line-height: 38px;font-size: 30px;font-weight: bold;text-align: center;color: #FFA500;padding-top: 25px;}
.content_pupop{width: 350px;height: 220px;line-height: 30px;font-size: 18px;text-align: center;padding-bottom: 10px;}
.lywq_buttonred{width: 350px;height: 50px;line-height: 50px;color: #fff;border-radius: 10px;text-align: center;}
.lywq_redbox{width: 350px;height: 50px;}
.lywq_mar{margin: 0 auto;}
.btn_pupop{background: #FFA500;width: 90px;height: 40px;border-radius: 10px;color: #fff;font-size: 18px;border: none;outline:none}
.lywq_cox {position: fixed;width: 100%;height: 100%;background: rgba(0, 0, 0, 0.2);display: none;top: 0;right: 0;bottom: 0;left: 0;overflow: hidden;outline: 0;-webkit-overflow-scrolling: touch;background-color: rgb(0, 0, 0);filter: alpha(opacity=60);background-color: rgba(0, 0, 0, 0.6);z-index: 9999;}
</style>